<style lang="less" scoped>
</style>
<template>
    <base-model
        @model-close="staffClose"
        @model-ok="staffOk"
        title="本月工时修改"
        :value="value"
        :loading="loading"
        @input="updateshow">
        <Form :model="form" :label-width="120" :ref="ref" :rules="rule">
            <FormItem label="工时：" prop="hours">
                <Input v-model="form.value" placeholder="请输入工时数" :maxlength="18" style="width: 200px"></Input>小时
            </FormItem>
        </Form>
    </base-model>
</template>
<script>
    export default {
        name: 'edithours',
        props: {
            value: {
                type: Boolean,
                default: false
            }
        },
        data () {
            return {
                ref: 'hoursForm',
                form: {
                    id: '',
                    value: ''
                },
                loading: true,
                rule: {
                }
            }
        },
        computed: {
        },
        methods: {
            setform (form) {
                this.$set(this.form, 'id', form)
            },
            updateshow (show) {
                this.$emit('input', show)
            },
            setuserdata (data) {
                this.$emit('setuserdata', data)
            },
            reset () {
                this.$refs[this.ref].resetFields();
                for (let item in this.form) {
                    this.$set(this.form, item, '')
                }
            },
            staffClose () {
                this.reset()
            },
            staffOk () {
                this.$refs[this.ref].validate((valid) => {
                    if (valid) {
                        this.http.addUserWorkTime(this, this.form)
                    } else {
                        this.loading = false
                        setTimeout(() => {
                            this.loading = true
                        }, 300)
                    }
                })

            }
        },
        components: {
        },
        mounted: function () {
        }
    };
</script>
